<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:h="http://java.sun.com/jsf/html" xmlns:f="http://java.sun.com/jsf/core" xmlns:p="http://primefaces.org/ui">
<ui:composition template="/resources/template/template.xhtml">

	<ui:define name="title">
		<h:outputText value="Détail du blog" />
	</ui:define>

	<ui:define name="content">
		<h:form>
			<h:panelGrid columns="2">
				<h:outputText value="BLOG : #{detaillerBlogBean.blog.nom}" />
				<p:outputPanel autoUpdate="true">
					<p:commandLink value="S'abonner" action="#{detaillerBlogBean.abonnement}" rendered="#{not detaillerBlogBean.blog.listeUtilisateurAbonne.contains(utilitaireBean.utilisateurSession)}" />
					<p:commandLink value="Se désabonner" action="#{detaillerBlogBean.desabonnement}" rendered="#{detaillerBlogBean.blog.listeUtilisateurAbonne.contains(utilitaireBean.utilisateurSession)}" />
				</p:outputPanel>
			</h:panelGrid>
		</h:form>
		<p:dataTable widgetVar="_datatableArticle" value="#{detaillerBlogBean.blog.listeArticle}" var="article" scrollable="true" scrollHeight="300" emptyMessage="Aucun article">

			<p:column>
				<p:link styleClass="ui-icon ui-icon-search" outcome="pretty:afficher-article">
					<f:param name="articleSlug" value="#{article.slug}" />
				</p:link>
			</p:column>

			<p:column>
				<f:facet name="header">
					<h:outputText value="NOM" />
				</f:facet>
				<h:outputText value="#{article.nom}" />
			</p:column>

			<p:column>
				<f:facet name="header">
					<h:outputText value="DATE CREATION" />
				</f:facet>
				<h:outputText value="#{article.dateCreation}">
					<f:convertDateTime pattern="dd/MM/yyyy HH:mm:ss" />
				</h:outputText>
			</p:column>

			<p:column>
				<f:facet name="header">
					<h:outputText value="CONTENU" />
				</f:facet>
				<h:outputText value="#{article.contenu}" escape="false" />
			</p:column>

		</p:dataTable>
	</ui:define>

	<ui:define name="dialog">

	</ui:define>

</ui:composition>
</html>